/*
class Solution {
public:
    ListNode* ReverseList(ListNode* head) {
        // write code here
        if (!head)
            return nullptr;

        ListNode* prev = nullptr, * cur = head;
        while (cur)
        {
            ListNode* next = cur->next;
            cur->next = prev;
            prev = cur, cur = next;
        }

        return prev;
    }
};


class Solution {
public:
    ListNode* EntryNode(ListNode* head) {
        if (!head)
            return nullptr;
        ListNode* slow = head, *fast = head;
        while (fast != nullptr && fast->next != nullptr)
        {
            fast = fast->next->next;
            slow = slow->next;
            if (fast == slow)
                return slow;
        }

        return nullptr;
    }

    ListNode* EntryNodeOfLoop(ListNode* head)
    {
        ListNode* slow = EntryNode(head);
        if (!slow)
            return nullptr;

        ListNode* fast = head;
        while (fast != slow)
        {
            fast = fast->next;
            slow = slow->next;
        }
        return slow;

    }
};

*/